/**
 * Created by CZ on 2017/4/21.
 */
module.exports = function ($scope,$state,RequestService,commonConfig,$localStorage) {
    $scope.User = $localStorage.get('cloud');
    $scope.currentPage = 1; //初始化分页为第一页
    //获取用户类型ids
    var developerId = null;
    RequestService.Request(commonConfig.userApi+'sys/usertype?tenantId=0','GET').then(function(response){
        console.log(response);
        angular.forEach(response,function(val,i){
            if(val.userTypeCode ==='Developer'){
                developerId = val.id;
            }
        });
        // console.log(userTypeIds);
        $scope.getList();
    },function(error){
        console.log(error);
    });
    //获取当前用户信息 (value = "审批状态", notes = "默认0，未审批为0，审批通过为1，审批不通过为-1")
    $scope.getList = function(){
        RequestService.Request(commonConfig.userApi+'user/user?status=-1&userTypeIds='+developerId+'&tenantId='+$scope.User.detail.tenantId+'&pageNum='+$scope.currentPage+'&pageSize=10&orderBy=id%20asc','GET').then(function(res){
            console.log(res);
            $scope.NotPassList = res.list;

            //分页控制
            $scope.maxSize = 5;
            $scope.totalItems = res.total;  //总数量
            $scope.totalPages = res.pages;   //总页数
            $scope.pageSize = 10; //每页显示数量
            $scope.currentPage = res.pageNum;
            $scope.PageNum = null;  //输入跳转
        },function(error){
            console.log(error);
        });
    };
    //分页跳转
    $scope.goPage = function(){
        // console.log($scope.currentPage);
        $scope.getList();
    };
    //手动输入跳转
    $scope.goPage2 = function(){
        // console.log($scope.PageNum);
        $scope.currentPage = $scope.PageNum;
        $scope.getList();
    };

};